import { Row, Col, Button } from 'antd';
import { CollapseHeaderParams } from '../interface';

interface CollpseHeaderProps extends React.PropsWithChildren<{}> {
    collapseHeader: CollapseHeaderParams;
}

export default function DefaultCollapseHeader(props: CollpseHeaderProps) {
    const { collapseHeader } = props;
    return (
        <Row justify="space-between">
            <Col>
                <Row>
                    <Col>{props.children}</Col>
                    <Col style={{ marginLeft: 8 }}>
                        <Button
                            disabled={collapseHeader.collapse}
                            htmlType="submit"
                            type="primary"
                        >
                            搜索
                        </Button>
                    </Col>
                </Row>
            </Col>

            <Col>
                <Button
                    type="ghost"
                    onClick={() => {
                        collapseHeader.setCollapse((s) => !s);
                    }}
                >
                    高级搜索
                </Button>
            </Col>
        </Row>
    );
}
